import {
  getAddress,
  getChinaList,
  addAddress,
  updateAddress
} from '../../api/addressApi.js'


import {
  getCategoryList
} from '../../api/categoryApi.js'


export default {
  namespaced: true,
  state: {
    //分类数据
    category_list: [],
    //当前鼠标略过的一级分类ID
    current_category_id: -1
  },
  getters: {},
  mutations: {
    //设置分类数据
    set_category_list(state, value) {
      state.category_list = value
    },
    //设置鼠标略过的一级分类ID
    set_current_category_id(state, value) {
      state.current_category_id = value
    }
  },
  actions: {
    get_category_list(context) {
      getCategoryList({}).then(function(response) {
        if (response.data.httpcode == 200) {
          context.commit('set_category_list', response.data.data);
        }
      })
    }
  }
}
